package net.zjitc.api;

import javax.swing.text.html.HTMLDocument;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/3/29 8:51
 */
public class RefereeTest {
    public static void main(String[] args) {
        System.out.println("请输入裁判人数");
        Scanner sc=new Scanner(System.in);
        int person=sc.nextInt();
        System.out.println("请输入各裁判的分数");
        ArrayList list=new ArrayList(person);
        for (int i = 0; i <person ; i++) {
            int score=sc.nextInt();
            list.add(score);
        }
        System.out.println("");
        Iterator iterator=list.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        Collections.sort(list);
        System.out.println("去掉一个最高分"+list.get(list.size()-1));
        System.out.println("去掉一个最低分"+list.get(0));
        list.remove(0);
        list.remove(list.size()-1);
        int result=0;
        for (int i = 0; i <list.size() ; i++) {
            int s=(int) list.get(i);
            result=result+s;
        }
        System.out.println("平均分为："+result/list.size());
    }
}
